import 'package:flutter/material.dart';
import 'package:huajianshe_app/common/C.dart';
import 'package:huajianshe_app/common/load_image.dart';

import 'RoundedCornerWidget.dart';

class AvatarWidget extends StatelessWidget {

  final String? url;
  final double size;
  final double? padding;
  final int? isCaptain;

  const AvatarWidget(this.url, this.size, this.padding, this.isCaptain, {Key? key, }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    if (isCaptain == 1) {//圈主
      return RoundedCornerWidget(width: size, height: size, radius: size / 2, padding: EdgeInsets.all(padding ?? 0),
          child: LoadImage.circleAvatar(url ?? '', size / 2, holderImg: 'placeholder'), borderWidth: 1, borderColor: C.primary, );
    } else {
      return RoundedCornerWidget(width: size, height: size, radius: size / 2, padding: EdgeInsets.all(0),
        child: LoadImage.circleAvatar(url ?? '', size / 2, holderImg: 'placeholder'), borderWidth: 0, borderColor: Colors.transparent,
      );
    }

  }
}